﻿using System.Text;

namespace Communication.Lib.Mode
{
    public class BIInfo : BaseInfo
    {
        public BiFlag Flag { get; set; }

        public int DataLength
        {
            get { return dataLength; }
        }

        public string Data
        {
            get { return _data; }
            set
            {
                _data = value;
                dataLength = Encoding.UTF8.GetBytes(_data).Length;
            }
        }

        private int dataLength = 0;

        private string _data;
    }

    public enum BiFlag : byte
    {
        Connection = 0x0a,
        Beat = 0x0b,
        Close = 0x0c,
        DevStatus = 0x0d,
        BagCount = 0x0e,
        Alarm = 0x0f
    }
}